package com.qiwenshare.file.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.qiwenshare.file.domain.SystemDO;
import lombok.Data;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @author CZF
 * @create 2024-01-22 2:58
 */
@Data
public class SystemVO {

    private Long id;

    /**
     * 1. cpu占用率
     * 2. 内存占用率
     * 3. 硬盘占用率
     * 4. 网络io流速
     */
    private Integer type;

    private Double used;

    private Double total;
    private Double rate;


    private String freshTime;

    public static SystemVO valueOf(SystemDO systemDO) {
        SystemVO vo = new SystemVO();
        vo.setId(systemDO.getId());
        vo.setRate(systemDO.getRate());
        vo.setFreshTime(systemDO.getFreshTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
        vo.setUsed(systemDO.getUsed());
        vo.setTotal(systemDO.getTotal());
        vo.setType(systemDO.getType());
        return vo;

    }
}
